package utils
{
	import core.Global;
	
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.utils.getTimer;
	
	import interfaces.IAction;

	public class Cartoon extends Sprite implements IAction
	{
		private var m_start:Boolean;
		private var m_pause:Boolean;
		
		protected var m_startTime:Number;
		protected var m_pauseTime:Number;
		
		public function Cartoon()
		{
			 
		}
		
		public function set pause(b:Boolean):void
		{
			// TODO Auto Generated method stub
			if(!start)return;	// 未开始，不能设置pause 属性
			m_pause = b;
			if(b)
			{
				m_pauseTime = getTimer();
			}else
			{
				m_startTime += (getTimer() - m_pauseTime)
			}
			
		}
		
		public function get pause():Boolean
		{
			// TODO Auto Generated method stub
			if(!m_start)return false;	// 未开始
			return m_pause;
		}
		
		public function set start(b:Boolean):void
		{
			// TODO Auto Generated method stub
			m_start = b;
			m_startTime = getTimer();
			
			if(b)
			{
				m_pause = false;
			}
			
		}
		
		public function destroy(e:* = null):void
		{
			Global.deleteAction(this);
			if(parent)
			{
				parent.removeChild(this);
			}
		}
		
		public function get start():Boolean
		{
			// TODO Auto Generated method stub
			return m_start;
		}
		
		public function update(t:Object=null):void
		{
			// TODO Auto Generated method stub
			if(!start || pause)return;
		}
		
	}
}